<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    	<%
		if(session.getAttribute("isAdminLogined")==null){
			return;
		}else{
			String isAddminLogined = session.getAttribute("isAdminLogined").toString();
			if(!("true".equals(isAddminLogined))){
				response.sendRedirect("login.jsp");
				return;
			}
		}
		
	%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>main</title>
<link rel="stylesheet" rev="stylesheet" href="${pageContext.request.contextPath}/css/admin/style-admin.css" type="text/css" media="all" />
<script src="${pageContext.request.contextPath}/js/jquery.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/jquery.ui.draggable.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/jquery.alerts.js" type="text/javascript"></script>
<link href="${pageContext.request.contextPath}/css/jquery.alerts.css" rel="stylesheet" type="text/css" media="screen" />


<link rel="stylesheet" type="text/css" media="all" href="${pageContext.request.contextPath}/js/calendar-brown.css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/calendar.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/calendar-zh.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/calendar-action.js"></script>
<script src="${pageContext.request.contextPath}/js/ajaxfileupload.js"
	type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function(){
			$("#fom").submit(function(){
 					if($("#url1").val()==""){
 						jAlert("请输入广告链接","消息");
							return false;
 	 				}

 					if($("#img").val()==""){
 						jAlert("请选择图片","消息");
							return false;
 	 				}

			});
			
});


/***********************************************************************************/	
function showProductEditor(){
	document.getElementById("Layer2").style.display = "";
	var top = (document.body.clientHeight-300)/2+"px";
	var left = (document.body.clientWidth-460)/2+"px";
	var div = document.getElementById("Layer2");
	div.style.top = top;
	div.style.left = left;
	showProductEdit();
}
function showProductEdit(){
	 document.getElementById("bgLayer").width = document.body.scrollWidth; 
	 document.all["bgLayer"].style.display="";
	 document.all["bgLayer"].style.height=document.body.scrollHeight;
	 document.getElementById("Layer2").style.display="";
	 timer=setInterval(moveProduct,"100");
}
function hideProductEdit(){
	clearInterval(timer);
	document.all["bgLayer"].style.display="none";
	document.all["Layer2"].style.display="none";
}
function moveProduct(){
	document.all["Layer2"].style.top=document.body.scrollTop+(document.body.clientHeight-300)/2;
	document.all["Layer2"].style.left=document.body.scrollLeft+document.body.clientWidth/2-230;
}
function displayDiv(){
   document.getElementById("Layer2").style.display = "none";
   hideProductEdit();
}	

/***********************************************************************************/	
function showProductEditor2(){
	document.getElementById("Layer3").style.display = "";
	var top = (document.body.clientHeight-300)/2+"px";
	var left = (document.body.clientWidth-460)/2+"px";
	var div = document.getElementById("Layer3");
	div.style.top = top;
	div.style.left = left;
	showProductEdit2();
}
function showProductEdit2(){
	 document.getElementById("bgLayer").width = document.body.scrollWidth; 
	 document.all["bgLayer"].style.display="";
	 document.all["bgLayer"].style.height=document.body.scrollHeight;
	 document.getElementById("Layer3").style.display="";
	 timer=setInterval(moveProduct2,"100");
}
function hideProductEdit2(){
	clearInterval(timer);
	document.all["bgLayer"].style.display="none";
	document.all["Layer3"].style.display="none";
}
function moveProduct2(){
	document.all["Layer3"].style.top=document.body.scrollTop+(document.body.clientHeight-300)/2;
	document.all["Layer3"].style.left=document.body.scrollLeft+document.body.clientWidth/2-230;
}



function uploadImage1(){
	var url = document.getElementById("contextPath").value+'/admin/updateGuangGaoImage1';
	if($("#smallImage1").val()==""){
		jAlert("请选择图片",'消息');
		return ;
	}
$.ajaxFileUpload   
    (   
        {   
            url:url,    
            secureuri:false,   
            fileElementId:'smallImage1',   
            dataType: '',   
            success: function(data, status)   
            {      
               jAlert(status,'消息');
               
               displayDiv();
               if(status=="success"){
            	   location.reload();
               }
            },   
            error: function (data, status, e)   
            {   
            	jAlert("保存文件失败",'消息');
            	displayDiv();
            }   
        }   
    );  
}



function uploadImage2(){


	
	var url = document.getElementById("contextPath").value+'/admin/updateGuangGaoImage2';
	if($("#smallImage2").val()==""){
		jAlert("请选择图片",'消息');
		return ;
	}
$.ajaxFileUpload
(   
    {   
        url:url,    
        secureuri:false,   
        fileElementId:'smallImage2',   
        dataType: '',   
        success: function(data, status)   
        {      
           jAlert(status,'消息');
           
           displayDiv();
           if(status=="success"){
        	   location.reload();
           }
        },   
        error: function (data, status, e)   
        {   
        	jAlert("保存文件失败",'消息');
        	displayDiv();
        }   
    }   
);  
}




</script>


<style type="text/css">
<!--
.atten {font-size:12px;font-weight:normal;color:#F00;}
-->
</style>
</head>

<body class="ContentBody">

<div style="z-index: 1;height: 1000">
<input id="contextPath" type="hidden" value="${pageContext.request.contextPath}" />
  <form action="${pageContext.request.contextPath}/admin/insertGuangGao" enctype="multipart/form-data" method="post" name="fom" id="fom" >
<div class="MainDiv">
<table width="99%" border="0" cellpadding="0" cellspacing="0" class="CContent">
  <tr> 
      <th class="tablestyle_title" >主页右下广告图配置</th>
  </tr>
  <tr>
    <td class="CPanel">
		<table border="0" cellpadding="0" cellspacing="0" style="width:100%">
		<tr>
		<td align="left">
			<a href="${pageContext.request.contextPath}/admin/uploadIndexImage.jsp">新增广告</a>
			<a href="${pageContext.request.contextPath}/admin/queryAllGuangGao2">编辑广告</a>
			
			
		</td>
			
		</tr>

		
		<tr align="center">
          <td class="TablePanel"></td>
		  </tr>
		  　<tr>
			<TD width="100%">
				<fieldset style="height:100%;">
				<legend>增加精彩促销</legend>
					  <table border="0" cellpadding="2" cellspacing="1" style="width:100%">
					 

					    <tr>
					    <td nowrap align="right" width="13%">广告链接:</td>
					    <td width="46%"><input name="url" id="url1" class="text" name="url" style="width:300px" type="text" size="40" />
				        <span class="red"> *</span></td>
					    <td align="right" width="9%"></td>
					    <td width="32%">&nbsp;</td>
					    </tr>
					    
					    <tr>
					    <td nowrap align="right" width="13%">广告图片:</td>
					    <td width="46%">
　　　　　　　　　　　　　<input id="img" name="uploadFile" type="file"  />
				        <span class="red"> *</span></td>
					    <td align="right" width="9%"></td>
					    <td width="32%">&nbsp;</td>
					    </tr>
					  </table>
			 <br />
				</fieldset>			
			</TD>
		</TR>
		
		</TABLE>
	
	
	 </td>
  </tr>
		<TR>
			<TD colspan="2" align="center" height="50px">
			<input type="submit" value="保存" class="button"/>　
			
			<input type="button" name="Submit2" value="返回" class="button" onclick="window.history.go(-1);"/></TD>
		</TR>
		</TABLE>
</div>
</form>
</div>
<div id="bgLayer" style="float:left;position:absolute;background:#CCCCCC;left:0px;top:0px;width:100%;height:1000;filter:alpha(style=0,opacity=50);display:none;z-index:2;"></div>

<div id="Layer2"  style=" display:none; border:0;background-image: url(/images/3Gsjj.jpg);position:absolute;top:1px; left:1px; width:528px; height:70px; z-index:3; text-align:left" >

  <div style="width: 450px;border-color: red;border: 1px solid;background-color: white;height: 130px">
  <fieldset>
  	<legend>上传增值业务缩略图</legend>
  	<table>
  	<tr>
  		<td>
  		　请选择：<input type="file" name="uploadFile" id="smallImage1">
  		<input type="button"  class="button" id="smallImageUpload" value="上传" onclick="uploadImage1();">
  		<input type="button" onclick="hideProductEdit('Layer2');" class="button"  value="取消"　>
  		</td>
  		<td>
  		</td>
  	</tr>
  	</table>
  </fieldset>
  	
  </div>

</div>


<div id="Layer3"  style=" display:none; border:0;background-image: url(/images/3Gsjj.jpg);position:absolute;top:1px; left:1px; width:528px; height:70px; z-index:3; text-align:left" >

  <div style="width: 450px;border-color: red;border: 1px solid;background-color: white;height: 130px">
  <fieldset>
  	<legend>上传增值业务缩略图</legend>
  	<table>
  	<tr>
  		<td>
  		　请选择：<input type="file" name="uploadFile" id="smallImage2">
  		<input type="button"  class="button" id="smallImageUpload" value="上传" onclick="uploadImage2();">
  		<input type="button" onclick="hideProductEdit2();" class="button"  value="取消"　>
  		</td>
  		<td>
  		</td>
  	</tr>
  	</table>
  </fieldset>
  	
  </div>

</div>



</body>
</html>